package home_work9;

import java.text.SimpleDateFormat;
import java.util.Date;

public class test4 {

	public static void main(String[] args) {
		Thread thread = new MyThread();
		thread.start();
		thread.interrupt();
	}
}

class MyThread extends Thread {
	SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
	public void run() {
		while (true) {
			String str = s.format(new Date());
			System.out.println(str);
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
